﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mob___first_encounter
{
    class Mob : Object
    {

        protected int healthPoints;
        protected int maxHealthPoints;
        protected int speed;
        protected double accuracy;
        protected int armor;					// rzeczywiste obrazenia = sila trafienia - pancerz
        protected Weapon weapon;
        protected bool canAttack;
        protected int attackAlarm;
        protected int attackPerSecond;
        protected int gameFPS;

        public Mob(int x, int y, Texture2D spriteTexture, int healthPoints, int speed, int armor, double accuracy, Weapon weapon, int attackPerSecond, int gameFPS)
        {
            Object(x, y, spriteTexture);
            this.healthPoints = healthPoints;
            maxHealthPoints = healthPoints;
            this.speed = speed;
            this.armor = armor;
            this.accuracy = accuracy;
            this.weapon = weapon;
            this.canAttack = true;
            this.attackPerSecond = attackPerSecond;
            this.gameFPS = gameFPS;
        }

        public Mob(int x, int y, Texture2D spriteTexture, int healthPoints, int speed, int armor, double accuracy, Weapon weapon, int attackPerSecond)
        {
            Object(x, y, spriteTexture);
            this.healthPoints = healthPoints;
            maxHealthPoints = healthPoints;
            this.speed = speed;
            this.armor = armor;
            this.accuracy = accuracy;
            this.weapon = weapon;
            this.canAttack = true;
            this.attackPerSecond = attackPerSecond;
            this.gameFPS = 30;
        }

        public int GetHealthPoints()
        {
            return healthPoints;
        }

        // Teoretycznie nie potrzebne mi to jezeli klasa Object ma metode MoveObject(int, int)
        protected void MoveAt(int x, int y)
        {
            MoveObject(x, y); // narazie zostawie to tak, ale jest to zbedne. Tylko po to zebym wykorzystywal jakos MoveAt do czegokolwiek
        }

        protected void AttackAt(int x, int y)
        {
            weapon.FireAt(weapon.bullet, x, y);
        }

        protected double CheckDistanceFrom(int x, int y)
        {
            return Math.Sqrt(Math.Pow((this.x - x), 2) + Math.Pow((this.y - y), 2));
        }

        protected void ChangeHealth(int points)
        {
            healthPoints = points;
            if (healthPoints == 0) DestroyMob();
        }
        protected void DestroyMob()
        {
            // narazie nic nie robi, bo nie wiem czy cos w c# potrzebne
            // ew. gdyby bron byla wskaznikiem, ale to tez nie wiem jak tu dziala
            //
        }
    }
}